package util;

import java.util.Map;

import android.content.Intent;

/**
 * title字符串工具类，因为titile太长影响美观，利用被类可以把title截取前20个字
 * @author t
 *
 */
public class StringUtil
{

    public static String getShortTile(Intent intent)
    {
        String titleFull = intent.getStringExtra("title");
        int index = titleFull.indexOf("(");
        if(index<0||index>20)
        {
            index = 20;
        }
        return titleFull.substring(0, index>titleFull.length()?titleFull.length():index);
    }
    public static String getShortTile(Map<String,String> intent)
    {
        String titleFull = intent.get("title");
        int index = titleFull.indexOf("(");
        if(index<0||index>20)
        {
            index = 20;
        }
        return titleFull.substring(0, index>titleFull.length()?titleFull.length():index);

    }
}
